#include "reg.h"
#include "ui_reg.h"
#include "log.h"
#include <QMessageBox>
#include <QTcpServer>
#include <QTcpSocket>


Reg::Reg(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Reg)
{
    ui->setupUi(this);
    msocket.connectToHost("192.168.19.1",8000);      //默认ip与port
}

Reg::~Reg()
{
    delete ui;
}

void Reg::on_pushButton_clicked()
{
    QString p1=ui->lineEdit->text();
    QString p2=ui->lineEdit_2->text();
    QString p3=ui->lineEdit_3->text();
    if(p2!=p3)
        QMessageBox::information(NULL, "Title", "请确认两次密码是否一致");
    if(p1=="" || p2=="")
        QMessageBox::information(NULL, "Title", "输入不可为空");
    else
    {
        msocket.write("$");      //在此约定$为reg的服务端写入
        msocket.write(p1.toUtf8());
        msocket.write(p2.toUtf8());
        QMessageBox::information(NULL, "Title", "注册成功");
    }   
}

